home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / language / asa / makefile < prev    next >
Makefile  |  1994-10-23  |  10KB  |  299 lines

  1. ## $Id: Makefile,v 4.2 1994/10/23 23:35:06 ingber Exp ingber $
  2.  
  3. ## ********************************************************************
  4. ## Please first read README, then examine this Makefile and CHANGES.
  5. ## ********************************************************************
  6.  
  7. MANIFEST = \
  8.     ASA \
  9.     ASA/README \
  10.     ASA/CHANGES \
  11.     ASA/Makefile \
  12.     ASA/NOTES \
  13.     ASA/COPYING \
  14.     ASA/README.ps \
  15.     ASA/readme.ms \
  16.     ASA/test_asa \
  17.     ASA/test_usr \
  18.     ASA/user.c \
  19.     ASA/user.h \
  20.     ASA/asa.c \
  21.     ASA/asa.h \
  22.     ASA/asa_user.h \
  23.     ASA/asa_opt \
  24.     ASA/README+.uu
  25.  
  26. ###
  27. ###        USER OPTIONS
  28. ### The policy is to try to have the asa module (not necessarily
  29. ### the user module) compile without "errors" (not necessarily without
  30. ### "warnings").  Some additional modifications may be needed on your
  31. ### machine; e.g., you might have to comment out the `#include <stdlib.h>'
  32. ### lines in asa_user.h.  See the current NOTES file for any updates on
  33. ### some standard implementations.
  34.  
  35. ###
  36. ## Defaults for various options are given below.  These can be
  37. ## overridden using DEFINE_OPTIONS.  If you include several options,
  38. ## separate them by a white space or place them conveniently on several
  39. ## lines; if the latter, be sure each line to be continued ends in a "\"
  40. ## (backslash).
  41.  
  42. ## This will run the ASA problem.
  43. DEFINE_OPTIONS = -DOPTIONS_FILE=TRUE -DASA_TEST=TRUE
  44. ##
  45. ## This ASA_TEMPLATE will run the ASA test problem multiple times, and
  46. ## separate the runs into different files.
  47. #DEFINE_OPTIONS = -DOPTIONS_FILE=FALSE -DUSER_ASA_OUT=TRUE \
  48. #-DTIME_CALC=TRUE -DASA_TEST=TRUE -DASA_TEMPLATE=TRUE
  49. ##
  50. ## This ASA_TEMPLATE illustrates the use of SELF_OPTIMIZE=TRUE.
  51. #DEFINE_OPTIONS = -DSELF_OPTIMIZE=TRUE -DOPTIONAL_DATA=TRUE \
  52. #-DUSER_ASA_OUT=TRUE -DASA_TEST=TRUE -DASA_TEMPLATE=TRUE
  53. ##
  54. ## This will run the ASA_SAMPLE problem
  55. #DEFINE_OPTIONS = -DOPTIONS_FILE=TRUE -DASA_TEMPLATE=TRUE  -DASA_SAMPLE=TRUE \
  56. #-DUSER_COST_SCHEDULE=TRUE
  57. ##
  58. ##This will run the ASA_PARALLEL code
  59. #DEFINE_OPTIONS = -DOPTIONS_FILE=TRUE -DASA_TEST=TRUE -DASA_TEMPLATE=TRUE \
  60. #-DASA_PARALLEL=TRUE
  61. ##
  62.  
  63. ###
  64. ###        Pre-Compile Options
  65. ###
  66. ## You can elect to read in the Program Options from asa_opt by
  67. ## setting OPTIONS_FILE=TRUE.  OPTIONS_FILE=TRUE can be set here or
  68. ## in asa_user.h.
  69. #-DOPTIONS_FILE=TRUE
  70.  
  71. ## Setting ASA_LIB=TRUE will facilitate your running asa() as a library
  72. ## call from another program, calling asa_main() in user.c.  In the
  73. ## templates, provided, all initializations and cost function definitions
  74. ## are set up in user.c.
  75. #-DASA_LIB=FALSE
  76.  
  77. ## If you do _not_ have an ANSI compiler set this to FALSE.
  78. ## If you use HAVE_ANSI=FALSE, change CC and CDEBUGFLAGS below.
  79. #-DHAVE_ANSI=TRUE
  80.  
  81. ## Some machines do not like any other I/O prototyping other than those
  82. ## in their own include files, e.g., like one convex that was tested.
  83. ## Other machines, like a Dec-3100 under Ultrix complained that the ANSI
  84. ## I/O prototypes were inconsistent.  A Sun under gcc gave warnings if no
  85. ## I/O prototypes were present.  Therefore, the defaults in asa_user.h and
  86. ## asa.h use K&R system prototypes even for the ANSI compiler, for
  87. ## fprintf, fflush, fclose, and exit, and for fscanf in user.h.  Setting
  88. ## IO_PROTOTYPES=FALSE will comment out even these declarations.
  89. #-DIO_PROTOTYPES=TRUE
  90.  
  91. ## Some systems do not have the time include files used here; others
  92. ## have different scales for time.  Setting TIME_CALC=TRUE will permit
  93. ## use of the time routines.
  94. #-DTIME_CALC=FALSE
  95.  
  96. ## Some systems, e.g., hpux, use other Unix-standard macros to access
  97. ## time.  Setting TIME_STD=TRUE when using TIME_CALC=TRUE will use these
  98. ## time routines instead.
  99. #-DTIME_STD=FALSE
  100.  
  101. ## Some smaller systems choke on `long int' and this option can be
  102. ## set to INT_LONG=FALSE to turn off warnings and possibly some errors.
  103. #-DINT_LONG=TRUE
  104.  
  105. ## Some machine may not permit the dimension of calloc be anything
  106. ## but int; in this case define INT_ALLOC=TRUE.  The default of FALSE
  107. ## is to set the dimension to that of LONG_INT, determined by INT_LONG.
  108. #-DINT_ALLOC=FALSE
  109.  
  110. ## You can define SMALL_FLOAT to better correlate to your own machine's
  111. ## maximum precision here if you know it.
  112. #-DSMALL_FLOAT=1.0E-18
  113.  
  114. ## You can define your own machine's minimum positive doubles here
  115. ## if you know it.
  116.  
  117. #-DMIN_DOUBLE=SMALL_FLOAT
  118.  
  119. ## You can define your own machine's maximum doubles here if you
  120. ## know it.
  121. #-DMAX_DOUBLE=1.0/SMALL_FLOAT
  122.  
  123. ## You can define your own machine's maximum precision here if you
  124. ## know it.
  125. #-DEPS_DOUBLE=SMALL_FLOAT
  126.  
  127. ## When parameter temperatures are less than SMALL_FLOAT, do not exit,
  128. ## and set them to SMALL_FLOAT.
  129. #-DNO_PARAM_TEMP_TEST=FALSE
  130.  
  131. ## When the cost temperature is less than SMALL_FLOAT, do not exit,
  132. ## and set it to SMALL_FLOAT.
  133. #-DNO_COST_TEMP_TEST=FALSE
  134.  
  135. ## You can try to use asa to self-optimize its own Program Options
  136. ## be setting SELF_OPTIMIZE=TRUE.  This can be very CPU-expensive as
  137. ## well as being dependent on your definition of recur_cost_function.
  138. #-DSELF_OPTIMIZE=FALSE
  139.  
  140. ## To use the ASA test problem, set ASA_TEST to TRUE.
  141. #-DASA_TEST=FALSE
  142.  
  143. ## To use testing templates in the user.c and asa.c files, associated
  144. ## with several OPTIONS, set ASA_TEMPLATE to TRUE.
  145. #-DASA_TEMPLATE=FALSE
  146.  
  147. ## It can be useful to return additional information to the user
  148. ## module from the asa module.  When OPTIONAL_DATA is set to TRUE, an
  149. ## additional pointer, *asa_data,  is available in DEFINES *OPTIONS to
  150. ## gather such data.
  151. #-DOPTIONAL_DATA=FALSE
  152.  
  153. ## The function used for the cost_function temperature  schedule is of
  154. ## the form test_temperature in asa.c.  You can define your own function
  155. ## of test_temperature adaptively in user.c in user_cost_schedule() (and
  156. ## in recur_user_cost_schedule() if SELF_OPTIMIZE is TRUE) by setting
  157. ## USER_COST_SCHEDULE to TRUE.
  158. #-DUSER_COST_SCHEDULE=FALSE
  159.  
  160. ## The macro used for reannealing parameter temperatures
  161. ## #define REANNEAL_FUNCTION(temperature, tangent, max_tangent) \
  162. ##  (temperature * (max_tangent / tangent))
  163. ## is defined in asa.h.  If you wish to adaptively control this function
  164. ## it can be defined in user.c in user_reanneal() (and in
  165. ## recur_user_reanneal() if SELF_OPTIMIZE is TRUE) by setting
  166. ## USER_REANNEAL_FUNCTION to TRUE.
  167. #-DUSER_REANNEAL_FUNCTION=FALSE
  168.  
  169. ## When ASA_SAMPLE is set to TRUE, data is collected by asa to
  170. ## importance-sample the users' variable space.
  171. #-DASA_SAMPLE=FALSE
  172.  
  173. ## When ASA_PARALLEL is set to TRUE, ASA is run in parallel-processor
  174. ## mode.
  175. #-DASA_PARALLEL=FALSE
  176.  
  177. ###
  178. ###        Printing Options
  179. ###
  180. ## Setting ASA_PRINT to FALSE will suppress all printing within asa.
  181. #-DASA_PRINT=TRUE
  182.  
  183. ## The name of the output file containing all printing from asa If you
  184. ## wish to attach a process number use ASA_OUT=\"asa_out_$$$$\" If
  185. ## ASA_OUT=\"STDOUT\" then ASA will print to stdout.
  186. #-DASA_OUT=\"asa_out\"
  187.  
  188. ## If your wish to have the printing from asa be sent to a file
  189. ## determined dynamically from the user module, set USER_ASA_OUT to
  190. ## TRUE, and define the Program Option *asa_out_file in the user module.
  191. ## (This overrides any ASA_OUT settings.)  In user.c, if
  192. ## USER_OPTIONS->asa_out_file = "STDOUT";, then ASA will print to stdout.
  193. #-DUSER_ASA_OUT=FALSE
  194.  
  195. ## Setting ASA_PRINT_INTERMED to FALSE will suppress intermediate
  196. ## printing within asa.
  197. #-DASA_PRINT_INTERMED=TRUE
  198.  
  199. ## Setting ASA_PRINT_MORE to TRUE will print out more intermediate
  200. ## information, e.g., new parameters whenever a new minimum is reported.
  201. #-DASA_PRINT_MORE=FALSE
  202.  
  203. ###
  204. ###        Compiler Choices
  205. ###
  206. ## If HAVE_ANSI=TRUE use this block; otherwise, use the K&R block below.
  207. ## The gnu C compiler is the default.  On Pyramid machines, you likely
  208. ## must add -Xa to CDEBUGFLAGS to use the HAVE_ANSI=TRUE (default) option.
  209. #CC = g++
  210. CC = gcc
  211. CDEBUGFLAGS = -g -O -Wall
  212. ## If you wish to include some profile statistics
  213. #CDEBUGFLAGS = -g -O -pg -Wall
  214. ##
  215. ## If you use your system's ANSI compiler, e.g., named cc, use this block.
  216. ## Sun's ANSI compiler is named acc, so use CC = acc for this one.
  217.  
  218. #CC = acc
  219. #CDEBUGFLAGS = -O
  220.  
  221. ## If HAVE_ANSI=FALSE use this K&R block.
  222. #CC = cc
  223. #CDEBUGFLAGS = -O
  224.  
  225. CFLAGS = $(CDEBUGFLAGS) $(DEFINE_OPTIONS)
  226.  
  227. all:
  228.     make compile
  229.     make run
  230. #    make profile
  231.  
  232. ###
  233. ###        Document Formatting
  234. ###
  235. doc:
  236. ## Use groff if you have it; add pep or colcrt to delete extra
  237. ## formatting.  Under groff, using `more' or `less' presents an enhanced
  238. ## text.  Otherwise, standard UNIX macros are fine.
  239.     groff -wall -R -t -Tascii -mgs readme.ms > README+
  240.     pep README+ > README
  241.     uuencode README+ README+ > README+.uu
  242.     /bin/rm README+
  243. ## The next 2 lines use standard UNIX utilities
  244. #    refer -e -P -n readme.ms | tbl | nroff -ms > README+
  245. #    refer -e -P -n readme.ms | tbl | nroff -ms | colcrt > README
  246. ##
  247. ## Similarly, you may format your own PostScript README.ps.
  248. ##
  249.     groff -wall -R -t -e -mgs readme.ms > README.ps
  250. ## if you format ps with Sun's NeWSprint,
  251. #    refer -e -P -n readme.ms | tbl | eqn | troff -ms -t | \
  252. #pl --r --e "" :opost > README.ps
  253.  
  254. ###
  255. ###        Other Standard Arguments to Make
  256. ###
  257. USEROBJS = user.o # the name of the calling object file
  258. ASAOBJS = asa.o # the ASA optimization object file
  259. ASA_USER_INCL = asa.h user.h
  260.  
  261. compile: $(USEROBJS) $(ASAOBJS)
  262.     @$(CC) $(LDFLAGS) -o asa_run $(USEROBJS) $(ASAOBJS) -lm
  263. ## test for memory leaks
  264. #compile: $(USEROBJS) $(ASAOBJS)
  265. #    @$(CC) $(LDFLAGS) -o asa_run $(USEROBJS) $(ASAOBJS) /usr/local/lib/leak.o -lm
  266.  
  267. $(USEROBJS): user.h
  268. $(ASAOBJS): asa.h
  269. $(ASA_USER_INCL): asa_user.h
  270.  
  271. profile:
  272.     gprof -z asa_run > asa_profile
  273.  
  274. ## CC and CFLAGS are passed into main, to be recorded in user_out.
  275. ## use a low value of nice for runs that are time- and CPU-intensive.
  276. run:
  277.     asa_run $(CC) $(CFLAGS)
  278. #    nice -19 asa_run $(CC) $(CFLAGS)
  279. #    profile
  280.  
  281. clean:
  282.     rm -f *\.o asa_run # core gmon.out
  283.  
  284. realclean:
  285.     rm -f *\.o asa_run user_out asa_out* # core gmon.out
  286.  
  287. docclean:
  288.     rm -f README README.ps
  289.  
  290. ## This shar is the comp.sources.unix/volume15/cshar version.
  291. shar:
  292.     (cd .. ; shar -o ASA-shar $(MANIFEST))
  293. ## Some versions of shar require a -f instead of -o.
  294. #    (cd .. ; shar -f ASA-shar $(MANIFEST))
  295.  
  296. tgz:
  297.     (cd .. ; tar cBf - ASA | gzip --best > ASA.tar.gz)
  298.  
  299.